/*
day56
2019.10.23
*/

struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
};

int helper(struct TreeNode *root, int sum)
{ 
	if (!root)  
	{
		return 0;
	}
	sum -= root->val; 
	return (sum == 0 ? 1 : 0) + helper(root->left, sum) + helper(root->right, sum);
}


int pathSum(struct TreeNode* root, int sum){
	if (!root ) 
	{
		return 0;
	}
	return helper(root, sum) + pathSum(root->left, sum) + pathSum(root->right, sum);
}



int main()
{
	return 0;
}
